package com.ruoyi.project.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.mapper.SysPersonMapper;
import com.ruoyi.project.system.domain.SysPerson;
import com.ruoyi.project.system.service.ISysPersonService;

/**
 * 员工Service业务层处理
 * 
 * @author theme
 * @date 2020-06-24
 */
@Service
public class SysPersonServiceImpl implements ISysPersonService 
{
    @Autowired
    private SysPersonMapper sysPersonMapper;

    /**
     * 查询员工
     * 
     * @param personId 员工ID
     * @return 员工
     */
    @Override
    public SysPerson selectSysPersonById(Long personId)
    {
        return sysPersonMapper.selectSysPersonById(personId);
    }

    /**
     * 查询员工列表
     * 
     * @param sysPerson 员工
     * @return 员工
     */
    @Override
    public List<SysPerson> selectSysPersonList(SysPerson sysPerson)
    {
        return sysPersonMapper.selectSysPersonList(sysPerson);
    }

    /**
     * 新增员工
     * 
     * @param sysPerson 员工
     * @return 结果
     */
    @Override
    public int insertSysPerson(SysPerson sysPerson)
    {
        sysPerson.setCreateTime(DateUtils.getNowDate());
        sysPerson.setDelFlag("0");
        return sysPersonMapper.insertSysPerson(sysPerson);
    }

    /**
     * 修改员工
     * 
     * @param sysPerson 员工
     * @return 结果
     */
    @Override
    public int updateSysPerson(SysPerson sysPerson)
    {
        sysPerson.setUpdateTime(DateUtils.getNowDate());
        return sysPersonMapper.updateSysPerson(sysPerson);
    }

    /**
     * 批量删除员工
     * 
     * @param personIds 需要删除的员工ID
     * @return 结果
     */
    @Override
    public int deleteSysPersonByIds(Long[] personIds)
    {
        return sysPersonMapper.deleteSysPersonByIds(personIds);
    }

    /**
     * 删除员工信息
     * 
     * @param personId 员工ID
     * @return 结果
     */
    @Override
    public int deleteSysPersonById(Long personId)
    {
        return sysPersonMapper.deleteSysPersonById(personId);
    }

    @DataScope(deptAlias = "b")
    public List<SysPerson> queryList(SysPerson sysPerson) {
        return sysPersonMapper.queryList(sysPerson);
    }
}
